/**
 * 屏幕适配逻辑
 */

class GameAdapter {
    // 游戏场景宽
    public static initWidth: number = 640;
    // 游戏场景高
    public static initHeight: number = 1136;

    public static ratio: number = 1;

    public constructor() {

    }

    /**
     * 竖屏适配
     */
    public static portraitAdaptive(): void {
        let ratio = GameAdapter.initWidth / GameAdapter.initHeight;
        let ratio1 = GameConfig.stage.stageWidth / GameConfig.stage.stageHeight;
        if (!egret.Capabilities.isMobile) {
            // PC场景下
            GameConfig.stage.scaleMode = egret.StageScaleMode.SHOW_ALL;
        } else {
            if (ratio1 <= ratio) {
                GameConfig.stage.scaleMode = egret.StageScaleMode.FIXED_WIDTH;
                GameAdapter.ratio = GameConfig.stage.stageWidth / GameAdapter.initWidth;
            }
        }
        console.log("适配模式:" + GameConfig.stage.scaleMode);
        GameLayerManager.instance().resetPos();
    }
}